import { request } from "@/utils/service"
import * as Login from "./types/login"

/** 登录并返回 Token */
export function loginApi(data: Login.LoginRequestData) {
  return request({
    url: "user/login",
    method: "post",
    data
  })
}

/** 用户信息 **/
export function getUserInfo() {
  return request({
    url: "user/info",
    method: "get"
  })
}

/** 角色信息 **/
export function getRoleInfo() {
  return request({
    url: "user/role",
    method: "get"
  })
}

/** 用户权限列表 **/
export function getUserPermission() {
  return request({
    url: "permission/findPermissionListByUserId",
    method: "get"
  })
}

/** 注册账号 **/
export function register(params: {}) {
  return request({
    url: "user/register",
    method: "post",
    data: params
  })
}

/** 用户列表**/
export function userList(params: {}) {
  return request({
    url: "user/alluserlist",
    method: "get",
    params: params
  })
}

/** 角色信息 **/
export function UserEdit(params: {}) {
  return request({
    url: "user/edit",
    method: "post",
    data: params
  })
}